package com.jie.myvhr.controller.emp;

import com.jie.myvhr.service.DepartmentService;
import com.jie.myvhr.service.EmpService;
import com.jie.myvhr.service.JobLevelService;
import com.jie.myvhr.service.PositionService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author jie
 * @date 2019/6/30 -15:52
 */
@RestController
@RequestMapping("/employee/basic")
public class EmpBasicController {

    @Resource
    private EmpService empService;
    @Resource
    private DepartmentService departmentService;
    @Resource
    private PositionService positionService;
    @Resource
    private JobLevelService jobLevelService;

    @RequestMapping(value = "/basicdata", method = RequestMethod.GET)
    public Map<String, Object> getAllNations() {
        Map<String, Object> map = new HashMap<>();
        //民族
        map.put("nations", empService.getAllNations());
        //政治面貌
        map.put("politics", empService.getAllPolitics());
        //请选择部门
        map.put("deps", departmentService.getDepByPid(-1L));
        //职位
        map.put("positions", positionService.getAllPos());
        //职称
        map.put("joblevels", jobLevelService.getAllJobLevels());
        //工号
        map.put("workID", String.format("%08d", empService.getMaxWorkID() + 1));
        return map;
    }


}
